<template>
	<view>
		<view class="header">
      <view class="num">{{ distributionBonus}}</view>
      <view>账户金额</view>
      <view class="cash-bnt" @tap="goCash">提现</view>
    </view>
    <view class="list">
      <view v-for="(item,index) in list" class="item">
        <view>
          <view class="flex" style="margin-bottom: 10rpx;">
             <view class="title">{{item.title}}</view>
             <view class="time">{{item.createTime}}</view>
          </view>
          <view class="flex">
            <view>{{item.details}}</view>
            <view style="color: red;"><span v-if="item.pm==1">+</span>
                  <span v-else>-</span>{{item.money}}
            </view>
          </view>
         </view>
      </view>
    </view>
	</view>
</template>

<script setup>
	 const list  = ref([])
   const current = ref(1)
   const distributionBonus=ref('')

   const pages = ref(0)
   onShow(() => {
     getlist(current.value)
      distributionBonus.value =uni.getStorageSync('info').distributionBonus
   })
   onReachBottom(() => {
     console.log(current.value + ','+current.value)
     if (current.value < pages.value) {
       getlist( current.value + 1)
     }
   })
   const goCash =()=>{
     uni.navigateTo({
       url: '/pages/cash/drawal'
     })
   }
   const getlist = (currentParam) => {
     uni.showLoading()
     http.request({
       url: '/p/user/fundDetail/page',
       method: 'GET',
       data: {
         current: currentParam,
         size: 10,
       }
     })
       .then(({ data }) => {
         console.log(data)
         let listParam = []
         if (data.current === 1) {
           listParam = data.records
         } else {
           listParam = list.value
           Array.prototype.push.apply(listParam, data.records)
         }
         list.value = listParam
         pages.value = data.pages
         current.value = data.current
         uni.hideLoading()
       })
   }
</script>

<style  scoped lang="scss">
  @use './cash.scss';

</style>
